#ifndef EXCELHANDLE_H
#define EXCELHANDLE_H

#include <QObject>
#include <QAxObject>
#include <QDir>
#include <QVariant>
#include <QVariantList>
#include <QFileInfo>
#include <QRegExp>
#include <QDebug>

class ExcelHandle : public QObject {
    Q_OBJECT
public:
    explicit ExcelHandle(QObject *parent = nullptr);
    ~ExcelHandle();

    void init(bool showWindow, bool showAlert, QString title);
    void save(QString url);
    void exit();
    void openBook(QString url);
    void openSheet(int n);
    void addSheet(QString name);
    void changeBook(QString name);
    void changeBook(int index);
    void deleteSheet(QString name);
    void writeData(int col, int row, QVariant data);
    void writeDataSet(QString start_Addr, QList<QList<QVariant>> data_Set);
    QList<QList<QVariant>> readData();

private:
    QAxObject *excel,
              *workbooks,
              *workbook,
              *sheets,
              *sheet,
              *usedRange;

    QString getEndAddr(QString start_Addr, int col, int row);
};

#endif // EXCELHANDLE_H
